From: Giovanni Campagna Date: Sun, 16 Dec 2012 22:52:33 +0000 (+0100) Subject: WorkspaceThumbnails: animate the right workspace when creating by DND X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~4447 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=ee0040ef1c84b153288862b1fcac2b48381ba04e;p=gnome-shell.git WorkspaceThumbnails: animate the right workspace when creating by DND To create a new workspace by dropping on the placeholder, we move all the windows down one workspace and then wait for _checkWorkspaces() to automatically create the empty one at the end. This means that, from the implementation POV, the new workspace is not the one created by DND but it's the last one, and this detail was exposed in the UI because the animation was applied on that one. Fix that by starting the animation manually from the DND code, and then blocking the animation from happening when the new workspace is created with a flag. https://bugzilla.gnome.org/show_bug.cgi?id=685285 --- diff --git a/js/ui/workspaceThumbnail.js b/js/ui/workspaceThumbnail.js index 4537b92c6..689ded035 100644 --- a/js/ui/workspaceThumbnail.js +++ b/js/ui/workspaceThumbnail.js @@ -558,6 +558,7 @@ const ThumbnailsBox = new Lang.Class({ this._dropPlaceholderPos = -1; this._dropPlaceholder = new St.Bin({ style_class: 'placeholder' }); this.actor.add_actor(this._dropPlaceholder); + this._spliceIndex = -1; this._targetScale = 0; this._scale = 0; @@ -740,6 +741,8 @@ const ThumbnailsBox = new Lang.Class({ return win.get_workspace() >= newWorkspaceIndex; }); + this._spliceIndex = newWorkspaceIndex; + // ... move them down one. windows.forEach(function(win) { win.meta_window.change_workspace_by_index(win.get_workspace() + 1, @@ -761,6 +764,14 @@ const ThumbnailsBox = new Lang.Class({ WORKSPACE_KEEP_ALIVE_TIME); } + // Start the animation on the workspace (which is actually + // an old one which just became empty) + let thumbnail = this._thumbnails[newWorkspaceIndex]; + this._setThumbnailState(thumbnail, ThumbnailState.NEW); + thumbnail.slidePosition = 1; + + this._queueUpdateStates(); + return true; } else { return false; @@ -848,7 +859,8 @@ const ThumbnailsBox = new Lang.Class({ this._thumbnails.push(thumbnail); this.actor.add_actor(thumbnail.actor); - if (start > 0) { // not the initial fill + if (start > 0 && this._spliceIndex == -1) { + // not the initial fill, and not splicing via DND thumbnail.state = ThumbnailState.NEW; thumbnail.slidePosition = 1; // start slid out this._haveNewThumbnails = true; @@ -863,6 +875,9 @@ const ThumbnailsBox = new Lang.Class({ // The thumbnails indicator actually needs to be on top of the thumbnails this._indicator.raise_top(); + + // Clear the splice index, we got the message + this._spliceIndex = -1; }, removeThumbnails: function(start, count) {